home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_mac.hqx / SRGP port to 5.0 (compressed) / SRGP_SPHIGS Root / MacSPHIGS / sphigs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-14  |  7.4 KB  |  283 lines

  1. #ifndef SPHIGS_H_INCLUDED_ALREADY
  2.  
  3. #define SPHIGS_H_INCLUDED_ALREADY
  4.  
  5. #include "mat3.h"
  6. #include "srgp_sphigs.h"
  7. #include "srgppublic.h"
  8.  
  9.  
  10. #ifdef SPHIGS_BOSS
  11. #define DECLARE
  12. #else
  13. #define DECLARE extern
  14. #endif
  15.  
  16.  
  17. /** LIMITATION CONSTANTS **/
  18. #define DEFAULT_MAX_STRUCTURE_ID    15
  19. #define DEFAULT_MAX_VIEW_INDEX         5
  20.  
  21. #define MAX_HIERARCHY_LEVEL        14
  22. #define MAX_NAME              31
  23.  
  24.  
  25. DECLARE short MAX_STRUCTURE_ID
  26. #ifdef SPHIGS_BOSS
  27.    = DEFAULT_MAX_STRUCTURE_ID
  28. #endif
  29.    ;
  30. DECLARE short MAX_VIEW_INDEX
  31. #ifdef SPHIGS_BOSS
  32.    = DEFAULT_MAX_VIEW_INDEX
  33. #endif
  34.    ;
  35.  
  36.  
  37.  
  38.  
  39. /** TYPE DEFINITIONS
  40. Geometric 2D floating-point.
  41. **/
  42. typedef struct {double x, y;}                NDC_point;
  43. typedef struct {NDC_point bottom_left, top_right;}    NDC_rectangle;
  44.  
  45.  
  46.  
  47.  
  48.  
  49. /*!*/
  50. /* RENDERING MODE CONSTANTS */
  51. #define WIREFRAME_RAW        1
  52. #define WIREFRAME        2  /* default */
  53. #define FLAT            3
  54. #define LIT_FLAT        4
  55. #define GOURAUD            5
  56.  
  57. /*!*/
  58. /* GEOMETRIC DATA TYPES */
  59. typedef MAT3vec            point;
  60. typedef MAT3vec         vector;
  61. typedef MAT3mat            matrix;
  62.  
  63. typedef short vertex_index;
  64.  
  65.  
  66. /*!*/
  67. /* NETWORK DELETION TYPES */
  68. #define UNCONDITIONAL    1
  69. #define CONDITIONAL    2
  70.  
  71. /* MATRIX CONCATENATION TYPES */
  72. #define ASSIGN            1
  73. #define PRECONCATENATE        2
  74. #define POSTCONCATENATE        3
  75.  
  76. /* PROJECTION TYPES */
  77. #define ORTHOGRAPHIC 0
  78. #define PERSPECTIVE  1
  79.  
  80. /* EDGE FLAGS */
  81. #define EDGE_VISIBLE 0
  82. #define EDGE_INVISIBLE 1
  83.  
  84. /* IMPLICIT REGENERATION MODES */
  85. #define SUPPRESSED 1
  86. #define ALLOWED    2
  87.  
  88.  
  89. #include "elementType.h"
  90.  
  91. #define SPH_setModXform(A,B)   \
  92.      A,SPH_setModelingTransformation (temp_matrix, B)
  93.  
  94.  
  95. /** TYPE DEFINITIONS 
  96. **/
  97.  
  98. typedef struct {
  99.     point position;
  100.     int   view_index;
  101.     int   button_chord[3];
  102.     int   button_of_last_transition;
  103. } locator_measure;
  104. #define viewIndex view_index
  105. #define locatorMeasure locator_measure
  106.  
  107. typedef
  108.    struct {
  109.      int structureID;
  110.      int elementIndex;
  111.      int elementType;    /* symbolic constants in elementType.h */
  112.      int pickID;
  113.    } pickPathItem;
  114.  
  115. typedef pickPathItem pickPath[MAX_HIERARCHY_LEVEL];
  116.  
  117. typedef struct {
  118.      int pickLevel;
  119.      pickPath path;
  120.    } pickInformation;
  121.  
  122. typedef long   nameset;   /* bit vector supporting 32 names */
  123. typedef char   name;      /* a number from 1 to 32 */
  124.  
  125.  
  126. /** PROTOTYPES FOR ALL PUBLIC SPHIGS ROUTINES **/
  127.  
  128. /****************************** state.c */
  129. void        SPH_begin (int width, int height, int color_planes_desired, 
  130.                int shades_per_flexicolor);
  131. void        SPH_setRenderingMode (int viewindex, int value);
  132. void         SPH_setDoubleBufferingFlag (boolean);
  133. void        SPH_end (void);
  134. void        SPH_setMaxStructureID (int);
  135. void        SPH_setMaxViewIndex (int);
  136.  
  137.  
  138. /****************************** utility.c */
  139. double         *SPH_defPoint (double *pt, double x, double y, double z);
  140. NDC_rectangle    SPH_defNDCrectangle 
  141.                    (double lx, double by, double rx, double ty);
  142.  
  143.  
  144. /****************************** filter.c */
  145. void         SPH_addToHiliteFilter (nameset);
  146. void         SPH_removeFromHiliteFilter (nameset);
  147. void         SPH_addToInvisFilter (nameset);
  148. void        SPH_removeFromInvisFilter (nameset);
  149.  
  150.  
  151. /****************************** element.c */
  152. void         SPH_addToNameSet (name);
  153. void         SPH_removeFromNameSet (name);
  154.  
  155. void         SPH_polyhedron (int numverts, int numfacets, 
  156.                 point *verts, vertex_index *facets);
  157. void         SPH_fillArea (int vCount, point *vertices);
  158. void         SPH_polyMarker(int vCount, point *vertices);
  159. void         SPH_polyLine (int vCount, point *vertices);
  160. void         SPH_text (point origin, char *string);
  161.  
  162. void         SPH_setInteriorColor (int value);
  163. void         SPH_setLineStyle (int LINE_STYLE);
  164. void         SPH_setLineColor (int value);
  165. void         SPH_setLineWidthScaleFactor (double value);
  166. void         SPH_setEdgeFlag (int value);
  167. void         SPH_setEdgeStyle (int LINE_STYLE);
  168. void         SPH_setEdgeColor (int value);
  169. void         SPH_setEdgeWidthScaleFactor (double value);
  170. void         SPH_setMarkerStyle (int MARKER_STYLE);
  171. void         SPH_setMarkerColor (int value);
  172. void         SPH_setMarkerSizeScaleFactor (double value);
  173. void         SPH_setTextFont (int value);
  174. void         SPH_setTextColor (int value);
  175.  
  176. void        SPH_setModelingTransformation (matrix, int method);
  177. void        SPH_clearModelingTransformation (void);
  178. void         SPH_label (int);
  179. void         SPH_setPickIdentifier (int);
  180. void         SPH_executeStructure (int structID);
  181.  
  182. /********************************* post.c */
  183. void         SPH_postRoot (int structID, int viewID);
  184. void         SPH_unpostRoot (int structID, int viewID);
  185. void         SPH_unpostAllRoots (int viewID);
  186.  
  187.  
  188. /********************************* edit.c */
  189. void         SPH_openStructure (int structID);
  190. void         SPH_closeStructure (void);
  191. int        SPH_inquireElementPointer (void);
  192.  
  193. void         SPH_setElementPointer (int elptr);
  194. void         SPH_offsetElementPointer (int offset);
  195. void         SPH_moveElementPointerToLabel (int label);
  196.  
  197. void         SPH_deleteElement (void);
  198. void         SPH_deleteElementsInRange (int index1, int index2);
  199. void         SPH_deleteElementsBetweenLabels (int lab1, int lab2);
  200.  
  201.  
  202. /***************************** refresh.c */
  203. void         SPH_setImplicitRegenerationMode (int mode);
  204. void         SPH_regenerateScreen (void);
  205.  
  206.  
  207. /***************************** view.c */
  208. void         SPH_evaluateViewOrientationMatrix 
  209.                    (point view_ref_point,
  210.             vector view_plane_normal, vector view_up_vector,
  211.             matrix vo_matrix /*varparm*/ );
  212.  
  213. void        SPH_evaluateViewMappingMatrix
  214.                    (double umin, double umax, double vmin, double vmax,
  215.             int proj_type,  /* ORTHOGRAPHIC or PERSPECTIVE */
  216.             point proj_ref_point,
  217.             double front_plane_dist, double back_plane_dist,
  218.             double viewport_minx, 
  219.             double viewport_maxx, 
  220.             double viewport_miny, 
  221.             double viewport_maxy,
  222.             double viewport_minz, 
  223.             double viewport_maxz,
  224.             matrix vm_matrix /*varparm*/ );
  225.  
  226. void         SPH_setViewRepresentation 
  227.                    (int viewIndex,
  228.             matrix vo_matrix, matrix vm_matrix,
  229.             double vp_minx, double vp_maxx, 
  230.             double vp_miny, double vp_maxy,
  231.             double vp_minz, double vp_maxz);
  232.             
  233. void        SPH_enableView (int viewIndex);    /* undocumented */
  234. void        SPH_disableView (int viewIndex);   /* undocumented */
  235.  
  236. void        SPH_setViewBackgroundColor (int viewIndex, int color);
  237.  
  238. void        SPH_setViewPointLightSource 
  239.                    (int viewIndex, double u, double v, double n);
  240.  
  241. /******************** input.c */
  242. #define SPH_setInputMode SRGP_setInputMode
  243. #define SPH_waitEvent SRGP_waitEvent
  244. #define SPH_getKeyboard SRGP_getKeyboard
  245. #define SPH_sampleKeyboard SRGP_sampleKeyboard
  246. #define SPH_setKeyboardProcessingMode SRGP_setKeyboardProcessingMode
  247. #define SPH_setKeyboardEchoColor SRGP_setKeyboardEchoColor
  248. #define SPH_setKeyboardEchoFont SRGP_setKeyboardEchoFont
  249. #define SPH_setKeyboardMeasure SRGP_setKeyboardMeasure
  250. #define SPH_setLocatorEchoCursorShape SRGP_setLocatorEchoCursorShape
  251. #define SPH_setLocatorButtonMask SRGP_setLocatorButtonMask
  252.  
  253. void        SPH_getLocator (locator_measure*);
  254. void        SPH_sampleLocator (locator_measure*);
  255. void        SPH_setLocatorMeasure (point position);
  256. void        SPH_setKeyboardEchoOrigin (point position);
  257.  
  258. void SPH_pickCorrelate (point npc_position, int viewindex, 
  259.             pickInformation *pickinfo);
  260.  
  261. void SPH_setPickIdentifier (int id);
  262.  
  263.  
  264.  
  265. /******************** modxform.c */
  266. void    SPH_scale (double x, double y, double z, matrix result);
  267. void    SPH_rotateX (double angle, matrix result);
  268. void    SPH_rotateY (double angle, matrix result);
  269. void    SPH_rotateZ (double angle, matrix result);
  270. void     SPH_translate (double x, double y, double z, matrix result);
  271. void    SPH_compose (matrix m1, matrix m2, matrix result);
  272.  
  273.  
  274. /******************** attribute.c */
  275.  
  276. void SPH_loadCommonColor (int microcolorindex, char *name);
  277.  
  278. #define SPH_beep      SRGP_beep
  279. #endif
  280.  
  281.  
  282. #undef DECLARE
  283.